-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nuke the const_to_allocation
query
#53850
Conversation
src/librustc_mir/interpret/memory.rs
Outdated
if let ConstValue::ByRef(_, allocation, _) = const_val.val { | ||
allocation | ||
} else { | ||
panic!("Trying to get allocation info from non-byref const value") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should say something about getting a non-ByRef
static. That's violation of an invariant.
src/librustc_typeck/check/mod.rs
Outdated
let alloc = if let ConstValue::ByRef(_, allocation, _) = static_.val { | ||
allocation | ||
} else { | ||
panic!("Trying to get allocation info from non-byref const value") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
CI is good, and I am happy as well except for the two nits. :) |
src/librustc_mir/interpret/memory.rs
Outdated
if let ConstValue::ByRef(_, allocation, _) = const_val.val { | ||
allocation | ||
} else { | ||
panic!("Matching on non-ByRef static") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, now that I think about this, could you replace panic!
by bug!
as well (in both cases)? That's what we usually do in the compiler for invariant violations. Sorry I didn't think of that yesterday.
Thanks! @bors r+ rollup+ |
📌 Commit db7da0e has been approved by |
@bors p=rollup I never know how to do this... |
@bors rollup |
Nuke the `const_to_allocation` query Closes rust-lang#53847 r? @RalfJung `./x.py check` works anyway, let's checkout tests from ci.
Rollup of 9 pull requests Successful merges: - #53076 (set cfg(rustdoc) when rustdoc is running on a crate) - #53622 (cleanup: Add main functions to some UI tests) - #53769 (Also link Clippy repo in the CONTRIBUTING.md file) - #53774 (Add rust-gdbgui script.) - #53781 (bench: libcore: fix build failure of any.rs benchmark (use "dyn Any")) - #53782 (Make Arc cloning mechanics clearer in module docs) - #53790 (Add regression test for issue #52060) - #53801 (Prevent duplicated impl on foreign types) - #53850 (Nuke the `const_to_allocation` query)
Closes #53847
r? @RalfJung
./x.py check
works anyway, let's checkout tests from ci.